<?php

class Arrastre_Model extends CI_Model {

    function grabarArrastre($parameters) {

        $insert = array(
            "ide_cur" => $parameters['ide_cur'],
            "ide_car_arr" => $parameters['ide_car_arr'],
            "ide_pen_arr" => $parameters['ide_pen_arr'],
            "ide_cic_arr" => $parameters['ide_cic_arr'],
            "materia_ide_mat_arr" => $parameters['materia_ide_mat_arr'],
            "docente_ide_doc_arr" => $parameters['docente_ide_doc_arr'],
            "seccion_arr" => $parameters['seccion_arr'],
            "paralelo_arr" => $parameters['paralelo_arr'],
            "estudiante_ide_est" => $parameters['estudiante_ide_est'],
            "observa_arr" => $parameters['observa_arr'],
            "eliminado" => 0);
        $this->db->insert("arrastre", $insert);
    }

    function EliminarArrastre( $ide_arr) {
        $this->db->trans_start();
        $this->db->where("ide_arr", $ide_arr);
        $this->db->delete("arrastre");
        $this->db->trans_complete();
    }

    function getDatosArrastre($ide) {
        $this->db->where('ide_mat', $ide);
        $this->db->where('eliminado_mat', 0);
        $query = $this->db->get('materia');
        if ($query->num_rows() > 0) {
            foreach ($query->result_array() as $row) {
                $data[] = $row; //$row;
            }
        }
        $query->free_result();
        return $data;
    }

    function getDatosArrastreCursa($id_cur) {
        $this->db->where('ide_cur', $id_cur);
        $this->db->where('observa_arr', 0);
        $query = $this->db->get('arrastre');
        if ($query->num_rows() > 0) {
            foreach ($query->result_array() as $row) {
                $data[] = $row; //$row;
            }
        }
        $query->free_result();
        return $data;
    }

    
}